#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int StrToInt(string str) {
        int flag = 1;
        long long ret = 0;
        if (str[0] == '+' || str[0] == '-')
        {
            if (str[0] == '-')
            {
                flag = -1;
            }
        }
        else if (str[0] >= '0' && str[0] <= '9')
        {
            ret += str[0] - '0';
        }
        else
        {
            return 0;
        }
        int i = 0;
        for (i = 1; i < str.size(); ++i)
        {
            if (str[i] >= '0' && str[i] <= '9')
            {
                ret *= 10;
                ret += str[i] - '0';
            }
            else
            {
                return 0;
            }
        }
        if (flag == -1)
        {
            ret *= -1;
        }
        return ret;
    }
};
int main()
{
    string str("-2147483647");
    int ret = Solution().StrToInt(str);
    cout << ret << endl;
    return 0;
}